package com.og.backingbean;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;

/**
 * @author Renaud DIANA
 *
 */
@Entity
@NamedQueries({@NamedQuery(name = "TimeSheet.findAll", query = "SELECT t FROM TimeSheet t ORDER BY t.idTimeSheet ASC")})
public class TimeSheet implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idTimeSheet;
	@NotNull
	@ManyToOne
	@JoinColumn(nullable = false)
	private Person person;
	@ManyToOne
	private Module module;	
	@ManyToOne	
	private Application application;
	@OneToMany(mappedBy = "timeSheet", cascade = CascadeType.ALL)
	@JoinColumn(name = "timesheet_idtimesheet")	
	private List<TimeSheetDate> listTimeSheetDate;
	
	/**
	 * default constructor
	 */
	public TimeSheet() {
		// TODO Auto-generated constructor stub
	}

	public int getIdTimeSheet() {
		return idTimeSheet;
	}

	public void setIdTimeSheet(int idTimeSheet) {
		this.idTimeSheet = idTimeSheet;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public Module getModule() {
		return module;
	}

	public void setModule(Module module) {
		this.module = module;
	}

	public Application getApplication() {
		return application;
	}

	public void setApplication(Application application) {
		this.application = application;
	}

	public List<TimeSheetDate> getListTimeSheetDate() {
		return listTimeSheetDate;
	}

	public void setListTimeSheetDate(List<TimeSheetDate> listTimeSheetDate) {
		this.listTimeSheetDate = listTimeSheetDate;
	}

}
